
#ifndef __PLACE_HOLDER_H__
#define __PLACE_HOLDER_H__

#ifndef __cplusplus
#	error This header requires a C++ compiler ...
#endif

#include <typeinfo>

#ifndef interface
#	define	interface	struct
#endif

interface anything
{
	virtual ~anything ( void ) { }

	virtual const std::type_info &	type ( void ) const = 0;
	virtual anything *				clone ( void ) const = 0;
	virtual size_t					size ( void ) const = 0;
};

////////////////////////////////////////////////////////////////////////
//  Declaration                                                       //
////////////////////////////////////////////////////////////////////////

template < typename value_type >
class placeholder : public anything
{
public:
	placeholder ( const value_type & value ) ;
	~placeholder ( void ) ;

public:	// inherit overriding
	const std::type_info &	type ( void ) const ;	// derived by interface anything
	anything *				clone ( void ) const ;	// derived by interface anything
	size_t					size ( void ) const ;	// derived by interface anything

private:
	value_type				value_ ;
} ;


////////////////////////////////////////////////////////////////////////
//  Definition                                                        //
////////////////////////////////////////////////////////////////////////

template < typename value_type >
placeholder<value_type>::placeholder ( const value_type & value )
:	value_ ( value )
{

}


template < typename value_type >
placeholder<value_type>::~placeholder ( void )
{

}


template < typename value_type >
const std::type_info & placeholder<value_type>::type ( void ) const
{
	return typeid ( value_type ) ;
}


template < typename value_type >
anything * placeholder<value_type>::clone ( void ) const
{
	return new placeholder ( this->value_ ) ;
}


template < typename value_type >
size_t placeholder<value_type>::size ( void ) const
{
	return sizeof ( this->value_ ) ;
}


#endif	// #ifndef __PLACE_HOLDER_H__